package com.jy.adscm.hcPlan.controller;


import com.jy.adscm.exception.AdscmSystemException;
import com.jy.adscm.hcPlan.bean.HcPlanFinalAssembly;
import com.jy.adscm.hcPlan.bean.HcPlanSale;
import com.jy.adscm.hcPlan.service.HcPlanMakePartExampleService;
import com.jy.adscm.hcPlan.service.HcPlanSaleService;
import com.jy.adscm.support.SimpleCoreResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 销售计划表 前端控制器
 * </p>
 *
 * @author yyy
 * @since 2018-08-13
 */
@RestController
@RequestMapping("/adscm/hcplan/hcPlanSale")
@CrossOrigin
public class HcPlanSaleController {

    @Autowired
    HcPlanSaleService hcPlanSaleService;



    /**
     * 查询所有销售任务
     * @return
     */
    @RequestMapping("/getAllSalePlan")
    public SimpleCoreResponse getAllSalePlan() throws AdscmSystemException{

        List<HcPlanSale> planSaleList = hcPlanSaleService.getAllSalePlan();

        return new SimpleCoreResponse("200","查询成功",planSaleList);
    }

    /**
     * 填写耗材销售计划
     * @param hcPlanSale
     * @return
     */
    public SimpleCoreResponse addSalePlan(HcPlanSale hcPlanSale) throws AdscmSystemException{

        hcPlanSaleService.addSalePlan(hcPlanSale);

        return new SimpleCoreResponse();
    }

}

